package com.mz.ozy.adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.mz.ozy.R;
import com.mz.ozy.activity.me.MsgDetailActivity;
import com.mz.ozy.bean.HomeMerBean;
import com.mz.ozy.bean.MsgBean;
import com.mz.ozy.utils.Utils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 *
 */

public class HomeGoodsAdapter extends RecyclerView.Adapter<HomeGoodsAdapter.MyViewHolder> {

    private Context mContext;
    List<HomeMerBean.ProductListBean> mBeanList;

    public HomeGoodsAdapter(Context context, List<HomeMerBean.ProductListBean> mBeanList) {
        mContext = context;
        this.mBeanList = mBeanList;
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new MyViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_organic_food, parent, false));
    }

    @Override
    public void onBindViewHolder(MyViewHolder holder, int position) {
        final HomeMerBean.ProductListBean bean = mBeanList.get(position);
        holder.goodsNameTv.setText(bean.getTradename());
        holder.describeTv.setText(bean.getDescribed());
    }

    @Override
    public int getItemCount() {
        return mBeanList.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tv_goods_name)
        TextView goodsNameTv;
        @BindView(R.id.tv_benifit_kind)
        TextView describeTv;

        public MyViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }


    }


}
